/*******************************************************************************
 * Copyright 2011 Google Inc. All Rights Reserved.
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *******************************************************************************/
package tr.edu.metu.is.mega.client.service;

import java.util.List;

import tr.edu.metu.is.mega.common.dto.ReviewerDTO;
import tr.edu.metu.is.mega.common.dto.SubmissionDTO;
import tr.edu.metu.is.mega.common.dto.SubmissionRevisionDTO;
import tr.edu.metu.is.mega.common.dto.SubmissionViewDTO;
import tr.edu.metu.is.mega.common.dto.UserRole;
import tr.edu.metu.is.mega.server.business.SubmissionViewManager;

import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;

@RemoteServiceRelativePath("../GwtSubmissionViewService")
public interface GwtSubmissionViewService extends RemoteService {

    /**
     * Utility class for simplifying access to the instance of async service.
     */
    public static class Util {

        private static GwtSubmissionViewServiceAsync instance;

        public static GwtSubmissionViewServiceAsync getInstance() {
            if (instance == null) {
                instance = GWT.create(GwtSubmissionViewService.class);
            }
            return instance;
        }
    }

    List<SubmissionViewDTO> getSubmissions(UserRole role, int courseid, int teamid);

    /**
     * @see SubmissionViewManager#uploadSubmission(SubmissionViewDTO)
     */
    public void uploadSubmission(SubmissionDTO view) throws Exception;

    /**
     * @see SubmissionViewManager#assignReviewer(SubmissionViewDTO)
     */
    public void assignReviewer(ReviewerDTO reviewer);
    
    public List<SubmissionRevisionDTO> getRevisions(int activityid, int teamid);
    
    public String downloadAll(UserRole role, int courseid, int teamid);
    
    public List<SubmissionDTO> querySubmissionsToReview(int reviewerTeam);
    
}
